const { db } = require("../config/dbConnect");
const model = db.model("stu", {
  name: { type: String, default: "username" },
  age: { type: Number },
  sex: { type: String },
});
const createModel = (postData) => {
  const insertObj = new model(postData);
  return insertObj
    .save()
    .then((res) => res)
    .catch((err) => false);
};
module.exports = createModel;
